home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / private / _putctty.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.8 KB  |  71 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #ifdef PDCDEBUG
  5. char *rcsid__putctty = "$Header: C:\CURSES\private\RCS\_putctty.c 2.1 1993/06/18 20:23:33 MH Rel MH $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_putctty()    - Output a character and attribute in TTY fashion.
  14.  
  15.   PDCurses Description:
  16.      This is a private PDCurses routine.
  17.  
  18.      Outputs character 'chr' to screen in tty fashion. If a colour
  19.      mode is active, the character is written with colour 'colour'.
  20.  
  21.      This function moves the physical cursor after writing so the
  22.      screen will scroll if necessary.
  23.  
  24.   PDCurses Return Value:
  25.      This function returns OK on success and ERR on error.
  26.  
  27.   PDCurses Errors:
  28.      No errors are defined for this function.
  29.  
  30.   Portability:
  31.      PDCurses    int PDC_putctty( chtype character, chtype color );
  32.  
  33. **man-end**********************************************************************/
  34.  
  35. int    PDC_putctty( chtype character, chtype color )
  36. {
  37. #ifdef    OS2
  38.     int curRow = PDC_get_cur_row ();
  39.     int curCol = PDC_get_cur_col ();
  40. #endif
  41.  
  42. #ifdef PDCDEBUG
  43.     if (trace_on) PDC_debug("PDC_putctty() - called\n");
  44. #endif
  45.  
  46. #ifdef    FLEXOS
  47.     retcode = s_write(0x00, 0x01L, (_far char *) &character, 1L, 0);
  48.     return( (retcode < 0L) ? ERR : OK );
  49. #endif
  50.  
  51. #ifdef    DOS
  52.     regs.h.ah = 0x0e;    /* Write in TTY fashion, advance cursor. */
  53.     regs.h.al = (unsigned char) (character & A_CHARTEXT);
  54.     regs.h.bh = _cursvar.video_page;
  55.     regs.h.bl = (unsigned char) ((color & A_ATTRIBUTES) >> 8);
  56.     int86(0x10, ®s, ®s);
  57.     return( OK );
  58. #endif
  59.  
  60. #ifdef    OS2
  61.     VioWrtTTY ((PCH)&character, 1, 0);
  62.     VioWrtNAttr ((PBYTE)&color, 1, (USHORT)curRow, (USHORT)curCol, 0);
  63.     return( OK );
  64. #endif
  65.  
  66. #ifdef UNIX
  67. /* INCOMPLETE */
  68.     return( OK );
  69. #endif
  70. }
  71.